﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Physis {

    public class FactoryBase {
        
        #region Private Properties

        private Application application = null;

        #endregion 


        #region Public Properties

        protected Application Application { get { return application; } }


        protected Data.Caching.CacheManager CacheManager { get { return application.CacheManager; } }

        protected TimeSpan CacheExpirationData { get { return application.CacheExpirationData; } }

        protected TimeSpan CacheExpirationReference { get { return application.CacheExpirationReference; } }


        protected Data.IDatabase EnterpriseDatabase { get { return application.EnterpriseDatabase; } }

        protected Data.IDatabase EnvironmentDatabase { get { return application.EnvironmentDatabase; } }

        #endregion 


        #region Constructors

        protected FactoryBase () { /* DO NOTHING */ }

        public FactoryBase (Application forApplication) {

            application = forApplication;

            return;

        }

        #endregion 


        #region Public Methods 

        protected void ClearLastException () {

            application.ClearLastException ();

            return;

        }

        protected void SetLastException (Exception exception) {

            application.SetLastException (exception);

            return;

        }

        #endregion 

    }

}
